<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SWM34S_LVGL7.11_SWMUI: C:/Users/DELL/Desktop/Commit/lvgl/SWM34S_LVGL7.11_SWMUI_20230515/APP/BSP/dev_sdram.c 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">SWM34S_LVGL7.11_SWMUI<span id="projectnumber">&#160;V7.9</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.5 -->
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_0ca16891106f5a3e9ad635a0d6c5f98f.html">APP</a></li><li class="navelem"><a class="el" href="dir_4ca18d753a70f6eada20fde478bd3fc8.html">BSP</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">dev_sdram.c</div></div>
</div><!--header-->
<div class="contents">
<a href="dev__sdram_8c.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="preprocessor">#include &quot;<a class="code" href="dev__sdram_8h.html">dev_sdram.h</a>&quot;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span><span class="preprocessor">#include &quot;<a class="code" href="version_8h.html">version.h</a>&quot;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="dev__sdram_8c.html#a6c3743105c81131817333ae7d2cf78a4">   29</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="dev__sdram_8c.html#a6c3743105c81131817333ae7d2cf78a4">sdram_init</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span>{</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span>    <span class="comment">/* 配置内部叠封 &lt;未引出&gt; 的端口 */</span></div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span>    <a class="code hl_function" href="dev__sdram_8c.html#a1ca4fa8f2864c10eb1fe5f8b59bc121d">sdram_port_init</a>();</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span> </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span>    SDRAM_InitStructure SDRAM_InitStruct;</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span> </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span><span class="preprocessor">#if (SDRAMM_SIZE == SIZE_2MB)</span></div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span>    SDRAM_InitStruct.Size = SDRAM_SIZE_2MB;</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span><span class="preprocessor">#elif (SDRAMM_SIZE == SIZE_8MB)</span></div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span>    SDRAM_InitStruct.Size = SDRAM_SIZE_8MB;</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span><span class="preprocessor">#elif (SDRAMM_SIZE == SIZE_16MB)</span></div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span>    SDRAM_InitStruct.Size = SDRAM_SIZE_16MB;</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span><span class="preprocessor">#elif (SDRAMM_SIZE == SIZE_32MB)</span></div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span>    SDRAM_InitStruct.Size = SDRAM_SIZE_32MB;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span><span class="preprocessor">#else </span><span class="comment">/* Default */</span><span class="preprocessor"></span></div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    SDRAM_InitStruct.Size = SDRAM_SIZE_8MB;</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span>    <span class="comment">/* 一分频: 即与 MCU 主频相同 */</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span>    SDRAM_InitStruct.ClkDiv = SDRAM_CLKDIV_1;</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span>    </div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span>    SDRAM_InitStruct.CASLatency = SDRAM_CASLATENCY_3;</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span>    SDRAM_InitStruct.TimeTRP  = SDRAM_TRP_2;</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span>    SDRAM_InitStruct.TimeTRCD = SDRAM_TRCD_2;</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span>    SDRAM_InitStruct.TimeTRFC  = SDRAM_TRFC_9;</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span>    SDRAM_Init(&amp;SDRAM_InitStruct);</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span>}</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span> </div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"><a class="line" href="dev__sdram_8c.html#a1ca4fa8f2864c10eb1fe5f8b59bc121d">   60</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="dev__sdram_8c.html#a1ca4fa8f2864c10eb1fe5f8b59bc121d">sdram_port_init</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>{</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span>    <span class="comment">/* 配置内部叠封 &lt;未引出&gt; 的端口 */</span></div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span>    PORT_Init(PORTM, PIN13, PORTM_PIN13_SDR_CLK, 0);</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span>    PORT_Init(PORTM, PIN14, PORTM_PIN14_SDR_CKE, 0);</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span>    PORT_Init(PORTB, PIN7,  PORTB_PIN7_SDR_WE,   0);</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span>    PORT_Init(PORTB, PIN8,  PORTB_PIN8_SDR_CAS,  0);</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span>    PORT_Init(PORTB, PIN9,  PORTB_PIN9_SDR_RAS,  0);</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span>    PORT_Init(PORTB, PIN10, PORTB_PIN10_SDR_CS,  0);</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span>    PORT_Init(PORTE, PIN15, PORTE_PIN15_SDR_BA0, 0);</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span>    PORT_Init(PORTE, PIN14, PORTE_PIN14_SDR_BA1, 0);</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span>    PORT_Init(PORTN, PIN14, PORTN_PIN14_SDR_A0,  0);</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span>    PORT_Init(PORTN, PIN13, PORTN_PIN13_SDR_A1,  0);</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span>    PORT_Init(PORTN, PIN12, PORTN_PIN12_SDR_A2,  0);</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span>    PORT_Init(PORTN, PIN11, PORTN_PIN11_SDR_A3,  0);</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span>    PORT_Init(PORTN, PIN10, PORTN_PIN10_SDR_A4,  0);</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span>    PORT_Init(PORTN, PIN9,  PORTN_PIN9_SDR_A5,   0);</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span>    PORT_Init(PORTN, PIN8,  PORTN_PIN8_SDR_A6,   0);</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span>    PORT_Init(PORTN, PIN7,  PORTN_PIN7_SDR_A7,   0);</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span>    PORT_Init(PORTN, PIN6,  PORTN_PIN6_SDR_A8,   0);</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span>    PORT_Init(PORTN, PIN3,  PORTN_PIN3_SDR_A9,   0);</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno">   81</span>    PORT_Init(PORTN, PIN15, PORTN_PIN15_SDR_A10, 0);</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span>    PORT_Init(PORTN, PIN2,  PORTN_PIN2_SDR_A11,  0);</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span>    PORT_Init(PORTM, PIN15, PORTM_PIN15_SDR_A12, 0);</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>    PORT_Init(PORTE, PIN7,  PORTE_PIN7_SDR_D0,   1);</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span>    PORT_Init(PORTE, PIN6,  PORTE_PIN6_SDR_D1,   1);</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span>    PORT_Init(PORTE, PIN5,  PORTE_PIN5_SDR_D2,   1);</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno">   87</span>    PORT_Init(PORTE, PIN4,  PORTE_PIN4_SDR_D3,   1);</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno">   88</span>    PORT_Init(PORTE, PIN3,  PORTE_PIN3_SDR_D4,   1);</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno">   89</span>    PORT_Init(PORTE, PIN2,  PORTE_PIN2_SDR_D5,   1);</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno">   90</span>    PORT_Init(PORTE, PIN1,  PORTE_PIN1_SDR_D6,   1);</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno">   91</span>    PORT_Init(PORTE, PIN0,  PORTE_PIN0_SDR_D7,   1);</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno">   92</span>    PORT_Init(PORTE, PIN8,  PORTE_PIN8_SDR_D8,   1);</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span>    PORT_Init(PORTE, PIN9,  PORTE_PIN9_SDR_D9,   1);</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>    PORT_Init(PORTE, PIN10, PORTE_PIN10_SDR_D10, 1);</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span>    PORT_Init(PORTE, PIN11, PORTE_PIN11_SDR_D11, 1);</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span>    PORT_Init(PORTE, PIN12, PORTE_PIN12_SDR_D12, 1);</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span>    PORT_Init(PORTE, PIN13, PORTE_PIN13_SDR_D13, 1);</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>    PORT_Init(PORTC, PIN14, PORTC_PIN14_SDR_D14, 1);</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span>    PORT_Init(PORTC, PIN15, PORTC_PIN15_SDR_D15, 1);</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span>    PORT_Init(PORTB, PIN6,  PORTB_PIN6_SDR_LDQM, 0);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span>    PORT_Init(PORTM, PIN12, PORTM_PIN12_SDR_UDQM,0);</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span>}</div>
<div class="ttc" id="adev__sdram_8c_html_a1ca4fa8f2864c10eb1fe5f8b59bc121d"><div class="ttname"><a href="dev__sdram_8c.html#a1ca4fa8f2864c10eb1fe5f8b59bc121d">sdram_port_init</a></div><div class="ttdeci">void sdram_port_init(void)</div><div class="ttdoc">配置芯片内置的 SDRAM 驱动端口</div><div class="ttdef"><b>Definition:</b> <a href="dev__sdram_8c_source.html#l00060">dev_sdram.c:60</a></div></div>
<div class="ttc" id="adev__sdram_8c_html_a6c3743105c81131817333ae7d2cf78a4"><div class="ttname"><a href="dev__sdram_8c.html#a6c3743105c81131817333ae7d2cf78a4">sdram_init</a></div><div class="ttdeci">void sdram_init(void)</div><div class="ttdoc">初始化 SDRAM Control 将芯片内置的 SDRAM 映射至 MCU 总线地址上</div><div class="ttdef"><b>Definition:</b> <a href="dev__sdram_8c_source.html#l00029">dev_sdram.c:29</a></div></div>
<div class="ttc" id="adev__sdram_8h_html"><div class="ttname"><a href="dev__sdram_8h.html">dev_sdram.h</a></div><div class="ttdoc">芯片内置 SDRAM</div></div>
<div class="ttc" id="aversion_8h_html"><div class="ttname"><a href="version_8h.html">version.h</a></div><div class="ttdoc">版本/目标控制</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5
</small></address>
</body>
</html>
